popover: Always apply the window shape
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 20 Feb 2014 15:24:59 +0000 (16:24 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 20 Feb 2014 15:36:34 +0000 (16:36 +0100)
In practice this shape is only used to outline the popover when it is
above native windows, in the most normal full-csw case the shape won't apply
visibly, so popovers will still be able to cast a shadow there.

If there are native windows below the popover, the shape will exclude the
shadow, so there are no alpha contents above the window. One worst case that
might happen is that the popover lays above patches of native/client-side
windows, so the shadow could come and go around the border. But first let's
see whether that happens often or visibly enough before adding something more
convoluted.

gtk/Makefile.am
gtk/gtkpopover.c
gtk/gtkpopoverprivate.h [deleted file]
gtk/gtkscalebutton.c

index d5ba0bd6ccd59ae0e81ad5d828e97ce1d937bced..6df2a89adb7aefc6f74511c62d918d4bc1298a17 100644 (file)
@@ -506,7 +506,6 @@ gtk_private_h_sources =             \
        gtkorientableprivate.h  \
        gtkpango.h              \
        gtkpathbar.h            \
-       gtkpopoverprivate.h     \
        gtkpressandholdprivate.h \
        gtkprintoperation-private.h \
        gtkprintutils.h         \
index 8415df12c6cb28e067a00851d4d5bf3e61cbfd6b..a309bbfec8251e56766a69d95facbc0d6624d9ec 100644 (file)
@@ -44,7 +44,6 @@
 #include <gdk/gdk.h>
 #include <cairo-gobject.h>
 #include "gtkpopover.h"
-#include "gtkpopoverprivate.h"
 #include "gtktypebuiltins.h"
 #include "gtkmain.h"
 #include "gtkwindowprivate.h"
@@ -123,6 +122,7 @@ gtk_popover_init (GtkPopover *popover)
   gtk_widget_set_has_window (widget, TRUE);
   popover->priv = gtk_popover_get_instance_private (popover);
   popover->priv->modal = TRUE;
+  popover->priv->apply_shape = TRUE;
 }
 
 static void
@@ -1815,24 +1815,6 @@ gtk_popover_get_modal (GtkPopover *popover)
   return popover->priv->modal;
 }
 
-void
-_gtk_popover_set_apply_shape (GtkPopover *popover,
-                              gboolean    apply_shape)
-{
-  GtkPopoverPrivate *priv = popover->priv;
-
-  g_return_if_fail (GTK_IS_POPOVER (popover));
-
-  apply_shape = apply_shape != FALSE;
-
-  if (priv->apply_shape == apply_shape)
-    return;
-
-  priv->apply_shape = apply_shape;
-  gtk_popover_update_position (popover);
-  gtk_widget_queue_draw (GTK_WIDGET (popover));
-}
-
 static void
 gtk_popover_tracker_remove_func (gint     position,
                                  gpointer user_data)
diff --git a/gtk/gtkpopoverprivate.h b/gtk/gtkpopoverprivate.h
deleted file mode 100644 (file)
index cd3be05..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright © 2014 Carlos Garnacho <carlosg@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __GTK_POPOVER_PRIVATE_H__
-#define __GTK_POPOVER_PRIVATE_H__
-
-#include "gtkpopover.h"
-
-void    _gtk_popover_set_apply_shape   (GtkPopover   *popover,
-                                        gboolean      apply_shape);
-
-#endif /* __GTK_POPOVER_PRIVATE_H__ */
index 4ef8a450899103434f597a8c0e14e0cb4f9cfe6e..29dee837574922fa1f95359892678b99b10c925d 100644 (file)
@@ -57,7 +57,6 @@
 #include "gtktypebuiltins.h"
 #include "gtkintl.h"
 #include "a11y/gtkscalebuttonaccessible.h"
-#include "gtkpopoverprivate.h"
 
 /**
  * SECTION:gtkscalebutton
@@ -357,9 +356,6 @@ gtk_scale_button_init (GtkScaleButton *button)
   gtk_widget_init_template (GTK_WIDGET (button));
   gtk_popover_set_relative_to (GTK_POPOVER (priv->dock), GTK_WIDGET (button));
 
-  /* FIXME: to be removed when compositing over native windows is fixed */
-  _gtk_popover_set_apply_shape (GTK_POPOVER (priv->dock), TRUE);
-
   /* Need a local reference to the adjustment */
   g_object_ref (priv->adjustment);